<template>
  <div>
    <div class="resource-manage">
      <div class="card-box">
        <div class="card-title">不动产信息</div>
        <el-form ref="propForm"
                 :model="propForm"
                 class="form-wrap"
                 size="small"
                 :rules="rules"
                 label-position="top">
          <el-form-item label="是否有不动产证"
                        prop="isCard"
                        v-if="addCardType === '10'"
                        v-show="!isAdd">
            <el-radio-group v-model="propForm.isCard"
                            size="small"
                            @change="handleARealEstateCertificate">
              <el-radio label="2">是</el-radio>
              <el-radio label="1">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="证件类型"
                        prop="cardType"
                        v-if="isAdd">
            <el-select v-model="propForm.cardType"
                       placeholder="请选择证件类型"
                       @change="handleChangeCardType"
                       v-if="addCardType === '10'"
                       disabled>
              <el-option v-for="item in cardTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
            <el-select v-model="propForm.cardType"
                       placeholder="请选择证件类型"
                       @change="handleChangeCardType"
                       v-if="addCardType === '20'"
                       disabled>
              <el-option v-for="item in cardTypesY"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
            <el-select v-model="propForm.cardType"
                       placeholder="请选择证件类型"
                       @change="handleChangeCardType"
                       v-if="addCardType === '30'"
                       disabled>
              <el-option v-for="item in cardTypesT"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="证件类型"
                        prop="cardType"
                        v-if="!isAdd">
            <el-select v-model="propForm.cardType"
                       placeholder="请选择证件类型"
                       @change="handleChangeCardType"
                       v-if="propForm.isCard === '2'">
              <el-option v-for="item in cardTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
            <el-select v-model="propForm.cardType"
                       placeholder="请选择证件类型"
                       @change="handleChangeCardType"
                       v-if="propForm.isCard === '1'">
              <el-option v-for="item in cardTypeList"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="cardNum"
                        prop="cardNum"
                        v-if="isAdd && !(addCardType === '10' && propForm.isCard === '1')">
            <el-input v-model="propForm.cardNum"
                      :placeholder="`请输入${cardNum}`"></el-input>
          </el-form-item>
          <el-form-item label="不动产证编号"
                        prop="cardNum"
                        v-if="!isAdd && propForm.cardType === '10'">
            <el-input v-model="propForm.cardNum"
                      placeholder="请输入不动产证编号"></el-input>
          </el-form-item>
          <el-form-item label="移交协议编号"
                        prop="cardNum"
                        v-if="!isAdd && propForm.cardType === '20'">
            <el-input v-model="propForm.cardNum"
                      placeholder="请输入移交协议编号"></el-input>
          </el-form-item>
          <el-form-item label="第三方评估机构报告编号"
                        prop="cardNum"
                        v-if="!isAdd && propForm.cardType === '30'">
            <el-input v-model="propForm.cardNum"
                      placeholder="请输入第三方评估机构报告编号"></el-input>
          </el-form-item>
          <el-form-item label="所属项目"
                        prop="projectId">
            <el-select v-model="propForm.projectId"
                       filterable
                       placeholder="请选择所属项目"
                       @change="handleChangeProjectId">
              <el-option v-for="item in projects"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="(国标码)资产分类代码"
                        prop="assetClassification">
            <el-select v-model="propForm.assetClassification"
                       placeholder="请选择（国标码）资产分类代码">
              <el-option v-for="item in assetClassificationTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="资产名称"
                        prop="assetName">
            <el-input v-model="propForm.assetName"
                      placeholder="请输入资产名称"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="使用状况"
                        prop="useStatus">
            <el-select v-model="propForm.useStatus"
                       placeholder="请选择使用状况">
              <el-option v-for="item in useStatusTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="取得方式"
                        prop="acquisitionMethod">
            <el-select v-model="propForm.acquisitionMethod"
                       placeholder="请选择取得方式">
              <el-option v-for="item in acquisitionMethodTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="取得日期"
                        prop="acquisitionDate">
            <el-date-picker v-model="propForm.acquisitionDate"
                            type="date"
                            value-format="yyyy-MM-dd"
                            format="yyyy-MM-dd"
                            placeholder="选择日期"
                            @change="changeTime"></el-date-picker>
          </el-form-item>
          <el-form-item label="投入使用日期"
                        prop="investmentAcquisitionDate">
            <el-date-picker v-model="propForm.investmentAcquisitionDate"
                            type="date"
                            value-format="yyyy-MM-dd"
                            format="yyyy-MM-dd"
                            placeholder="选择日期"
                            @change="changeTime"></el-date-picker>
          </el-form-item>
          <el-form-item label="价值类型"
                        prop="valueType">
            <el-select v-model="propForm.valueType"
                       placeholder="请选择价值类型">
              <el-option v-for="item in valueTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="登记价/评估价(元)"
                        prop="registrationPrice">
            <el-input v-model="propForm.registrationPrice"
                      placeholder="请输入登记价或评估价"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="登记费(元)"
                        prop="registrationFee">
            <el-input v-model="propForm.registrationFee"
                      placeholder="请选择登记费"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="税费(元)"
                        prop="taxation">
            <el-input v-model="propForm.taxation"
                      placeholder="请选择税费"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="价值(元)"
                        prop="value">
            <el-input v-model="propForm.value"
                      placeholder="请输入价值"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="数量"
                        prop="number">
            <el-input v-model="propForm.number"
                      placeholder="请输入数量"
                      maxlength="5"></el-input>
          </el-form-item>
          <el-form-item label="计量单位(m²)"
                        prop="measurementUnit">
            <el-input v-model="propForm.measurementUnit"
                      placeholder="请输入计量单位"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="宗地号"
                        prop="landNumber">
            <el-input v-model="propForm.landNumber"
                      placeholder="请输入宗地号"
                      disabled></el-input>
          </el-form-item>
          <el-form-item label="宗地面积(m²)"
                        prop="landAreaCard">
            <el-input v-model="propForm.landAreaCard"
                      placeholder="请输入宗地面积"
                      disabled>
            </el-input>
          </el-form-item>
          <el-form-item label="建筑/土地面积(m²)"
                        prop="landArea">
            <el-input v-model="propForm.landArea"
                      placeholder="请输入建筑/土地面积"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="权属证号"
                        prop="ownershipCertificateNo">
            <el-input v-model="propForm.ownershipCertificateNo"
                      maxlength="30"
                      placeholder="请输入权属证号"></el-input>
          </el-form-item>
          <el-form-item label="发证日期"
                        prop="issueData">
            <el-date-picker v-model="propForm.issueData"
                            type="date"
                            value-format="yyyy-MM-dd"
                            format="yyyy-MM-dd"
                            placeholder="选择日期"></el-date-picker>
          </el-form-item>
          <el-form-item label="权属年限(月)"
                        prop="ownershipPeriod">
            <el-input v-model="propForm.ownershipPeriod"
                      placeholder="请输入权属年限（月）"
                      maxlength="5"></el-input>
          </el-form-item>
          <el-form-item label="权属证明"
                        prop="ownershipCertificate">
            <el-select v-model="propForm.ownershipCertificate"
                       placeholder="请输入权属证明">
              <el-option v-for="item in ownershipCertificateTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="坐落位置"
                        prop="location">
            <el-input v-model="propForm.location"
                      placeholder="请输入坐落位置"
                      maxlength="30"></el-input>
          </el-form-item>
          <el-form-item label="权属性质"
                        prop="ownershipNature">
            <el-select v-model="propForm.ownershipNature"
                       placeholder="请选择权属性质">
              <el-option v-for="item in ownershipNatureTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="自用面积(m²)"
                        prop="selfUseArea">
            <el-input v-model="propForm.selfUseArea"
                      placeholder="请输入自用面积"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="自用价值(元)"
                        prop="selfUseValue">
            <el-input v-model="propForm.selfUseValue"
                      placeholder="请输入自用价值"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="建筑结构"
                        prop="buildingStructure">
            <el-select v-model="propForm.buildingStructure"
                       placeholder="请选择建筑结构">
              <el-option v-for="item in buildingStructureTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="折旧状态"
                        prop="depreStatus">
            <el-select v-model="propForm.depreStatus"
                       placeholder="请选择折旧状态">
              <el-option v-for="item in depreStatusTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="累计折旧额(元)"
                        prop="accumDepre">
            <el-input v-model="propForm.accumDepre"
                      placeholder="请输入累计折旧额"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="预计使用年限(年)"
                        prop="estimatedLife">
            <el-input v-model="propForm.estimatedLife"
                      placeholder="请输入预计使用年限"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="初始折旧月份(月)"
                        prop="initDepreMonth">
            <el-input v-model="propForm.initDepreMonth"
                      placeholder="请输入初始折旧月份"
                      maxlength="5"></el-input>
          </el-form-item>
          <el-form-item label="上次折旧月份(月)"
                        prop="lastDepreMonth">
            <el-input v-model="propForm.lastDepreMonth"
                      placeholder="请输入上次折旧月份"
                      maxlength="5"></el-input>
          </el-form-item>
          <el-form-item label="残值率"
                        prop="salvageValue">
            <el-input v-model="propForm.salvageValue"
                      placeholder="请输入残值率"
                      @blur="handleBulr"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="是否政府投资项目"
                        prop="assetRegistrationId">
            <!--<el-select v-model="propForm.assetRegistrationId" placeholder="请选择政府投资项目" @change="handleChangeAssetRegistration">
                      <el-option v-for="item in assetRegistrationTypes"
                                 :key="item.assetRegistrationId"
                                 :label="item.projectName"
                                 :value="item.assetRegistrationId"
                      ></el-option>
                  </el-select>-->
            <el-radio-group v-model="propForm.assetRegistrationId"
                            size="small"
                            @change="handleChangeAssetRegistration">
              <el-radio label="0">是</el-radio>
              <el-radio label="1">否</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="土地用途"
                        prop="landType">
            <el-select v-model="propForm.landType"
                       placeholder="请选择土地用途"
                       disabled>
              <el-option v-for="item in landUses"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="规划用途"
                        prop="planningType">
            <el-select v-model="propForm.planningType"
                       placeholder="请选择规划用途">
              <el-option v-for="item in planUses"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="登记日期"
                        prop="registrationDate">
            <el-date-picker v-model="propForm.registrationDate"
                            type="date"
                            value-format="yyyy-MM-dd"
                            format="yyyy-MM-dd"
                            placeholder="选择日期"></el-date-picker>
          </el-form-item>
          <el-form-item label="竣工时间"
                        prop="completionTime">
            <el-date-picker v-model="propForm.completionTime"
                            type="date"
                            value-format="yyyy-MM-dd"
                            format="yyyy-MM-dd"
                            placeholder="选择日期"></el-date-picker>
          </el-form-item>
          <el-form-item label="权利人"
                        prop="obligee">
            <el-input v-model="propForm.obligee"
                      placeholder="请输入权利人"
                      maxlength="25"></el-input>
          </el-form-item>
          <el-form-item label="资产编码"
                        prop="assetCode">
            <el-input v-model="propForm.assetCode"
                      placeholder="请输入资产编码"
                      maxlength="50"></el-input>
          </el-form-item>
          <el-form-item label="产权形式"
                        prop="propertyRightForm">
            <el-select v-model="propForm.propertyRightForm"
                       placeholder="请选择产权形式">
              <el-option v-for="item in proprietaryTypes"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <!--<el-form-item label="详细地址" prop="address" class="addr-info">
                  <el-input v-model="propForm.address" placeholder="请输入详细地址" disabled></el-input>
              </el-form-item>-->
          <!--<div class="full">
                  <el-row :gutter="30">
                      <el-col :span="18">
                          <div class="col-one address-wrap">
                              <el-form-item label="通讯地址" prop="provinceCode">
                                  <el-select v-model="propForm.provinceCode" filterable @change="queryCitys"  placeholder="请选择地址" @blur="handleBlurProvince">
                                      <el-option
                                          v-for="item in provinces"
                                          :key="item.value"
                                          :label="item.label"
                                          :value="item.value"
                                      ></el-option>
                                  </el-select>
                              </el-form-item>
                              <el-form-item label='' class="no-top-padding" prop="cityCode">
                                  <el-select v-model="propForm.cityCode" filterable @change="queryCounty"  placeholder="请选择地址" @blur="handleBlurCity">
                                      <el-option
                                          v-for="item in citys"
                                          :key="item.value"
                                          :label="item.label"
                                          :value="item.value"
                                      ></el-option>
                                  </el-select>
                              </el-form-item>
                              <el-form-item label=""  class="no-top-padding" prop="countyCode">
                                  <el-select v-model="propForm.countyCode" filterable  placeholder="请选择地址" @blur="handleBlurCounty">
                                      <el-option
                                          v-for="item in countys"
                                          :key="item.value"
                                          :label="item.label"
                                          :value="item.value"
                                      ></el-option>
                                  </el-select>
                              </el-form-item>
                          </div>
                      </el-col>
                      <el-col :span="6">
                          <el-form-item label="详细地址" prop="address" class="addr-info">
                              <el-input v-model="propForm.address" placeholder="请输入详细地址"></el-input>
                          </el-form-item>
                      </el-col>
                  </el-row>
              </div>-->
          <el-form-item label="物业地址"
                        prop="cityCode"
                        class="full">
            <el-row :gutter="10">
              <el-col :span="4">
                <el-select placeholder="请选择市"
                           v-model="propForm.cityCode"
                           disabled>
                  <el-option v-for="item in cityAssembly"
                             :key="item.value"
                             :label="item.label"
                             :value="item.value">
                  </el-option>
                </el-select>
              </el-col>
              <el-col :span="5">
                <el-select placeholder="请选择区"
                           v-model="propForm.countyCode"
                           disabled>
                  <el-option v-for="item in (this.propForm.cityCode === '') ? [] : districtCollection"
                             :key="item.value"
                             :label="item.label"
                             :value="item.value">
                  </el-option>
                </el-select>
              </el-col>
              <el-col :span="5">
                <el-select placeholder="请选择街道"
                           v-model="propForm.roomStreet"
                           disabled>
                  <el-option v-for="item in (this.propForm.countyCode === '') ? [] : projectStreet"
                             :key="item.value"
                             :label="item.label"
                             :value="item.value">
                  </el-option>
                </el-select>
              </el-col>
              <el-col :span="5">
                <el-select placeholder="请选择社区"
                           v-model="propForm.communityName"
                           disabled>
                  <el-option v-for="item in (this.propForm.roomStreet === '') ? [] : communityNames"
                             :key="item.value"
                             :label="item.label"
                             :value="item.value">
                  </el-option>
                </el-select>
              </el-col>
              <el-col :span="5">
                <el-input maxlength="50"
                          placeholder="请输入道路及门牌号"
                          v-model="propForm.address"
                          disabled></el-input>
              </el-col>
            </el-row>
          </el-form-item>
          <el-form-item label="备注"
                        prop="remarks"
                        class="full">
            <el-input v-model="propForm.remarks"
                      placeholder="请输入备注"
                      maxlength="200"></el-input>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="resource-manage">
      <relevancyProperty ref="relevancyProperty"
                         :pid="id"
                         :projectId.sync="propForm.projectId"></relevancyProperty>
    </div>
    <div class="resource-manage">
      <governmentInvestment ref="governmentInvestment"
                            :pid="id"
                            :projectId.sync="propForm.projectId"
                            :governmentInvestmentId="governmentInvestmentId"
                            @handleSelectRow="handleSelectRow"
                            v-show="governmentInvestmentFlag">
      </governmentInvestment>
    </div>
    <div class="resource-manage">
      <div class="card-box">
        <div class="card-title">上传文件</div>
        <div style="padding: 20px 20px">
          <v-upload ref="propertyCardFileUpload"
                    :busId="id"
                    :modelType="modelType"
                    @onSuccess="onSuccess"
                    isShowFileList
                    :isView="false"
                    multiple
                    v-model="uploadFileList" />
        </div>
      </div>
    </div>
    <div class="resource-manage">
      <div class="card-box">
        <el-form size="small"
                 class="but_form">
          <el-form-item class="col-two">
            <el-button type="primary"
                       v-throttle="[()=>submitForm('propForm')]">保存</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script src='./property_form.js'>
</script>

<style scoped lang="scss">
@import './property_form';
</style>
